<template>
  <div>
    <el-select v-model="value" placeholder="请选择省份" filterable @change="provinceChange">
      <el-option
        v-for="item in province"
        :key="item.id"
        :label="item.value"
        :value="item.id">
      </el-option>
    </el-select>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { GetProvinceList } from '../../api/select'
export default {
  name: 'province',
  data () {
    return {
      province: '',
      value: ''
    }
  },
  mounted () {
    this.$store.dispatch('SetProvinceId', 0)
    GetProvinceList().then(res => {
      this.province = [{ id: 0, value: '全部' }].concat(res.data.province)
    })
  },
  computed: {
    ...mapGetters([
      'roles'
    ])
  },
  methods: {
    provinceChange (selVal) {
      this.$store.dispatch('SetProvinceId', selVal)
    }
  }
}
</script>

<style scoped>

</style>
